package com.dragon.modules.yuegou.query.system;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.system.UserEntity;
import com.dragon.modules.yuegou.enums.system.UserGender;
import com.dragon.modules.yuegou.enums.system.UserStatus;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 系统用户表--- 这块包含登录大运营平台、集团版本、悦商惠版本等除C端会员的所有用户集合 动态查询条件
 * 
 * @author pbuilder generated
 * @date 2019-03-15 15:37:59
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class UserQuery extends UserEntity implements Query<UserEntity> {

    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "username")
	private Condition<String> usernameCondition;

    /** 手机号查询条件 */
	@JsonUnwrapped(prefix = "mobile")
	private Condition<String> mobileCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "email")
	private Condition<String> emailCondition;

    /** 身份证查询条件 */
	@JsonUnwrapped(prefix = "idCard")
	private Condition<String> idCardCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "password")
	private Condition<String> passwordCondition;

    /** 盐，用于密码签名查询条件 */
	@JsonUnwrapped(prefix = "salt")
	private Condition<String> saltCondition;

    /** [枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件 */
	@JsonUnwrapped(prefix = "gender")
	private Condition<UserGender> genderCondition;

    /** [枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件 */
	@JsonUnwrapped(prefix = "status")
	private Condition<UserStatus> statusCondition;

    /** 最后登陆时间查询条件 */
	@JsonUnwrapped(prefix = "lastLoginTime")
	private Condition<LocalDateTime> lastLoginTimeCondition;

    /** 密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件 */
	@JsonUnwrapped(prefix = "pwdWrongNumber")
	private Condition<Boolean> pwdWrongNumberCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "modifiedTime")
	private Condition<LocalDateTime> modifiedTimeCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "modifiedBy")
	private Condition<String> modifiedByCondition;

    /** 逻辑删除，1表示已删除,0表示未删除查询条件 */
	@JsonUnwrapped(prefix = "del")
	private Condition<Boolean> delCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "delBy")
	private Condition<String> delByCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "delTime")
	private Condition<LocalDateTime> delTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public UserQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public UserQuery(UserEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public UserQuery(UserQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.usernameCondition != null) {
			this.usernameCondition = other.usernameCondition.copy();
		}
		if(other.mobileCondition != null) {
			this.mobileCondition = other.mobileCondition.copy();
		}
		if(other.emailCondition != null) {
			this.emailCondition = other.emailCondition.copy();
		}
		if(other.idCardCondition != null) {
			this.idCardCondition = other.idCardCondition.copy();
		}
		if(other.passwordCondition != null) {
			this.passwordCondition = other.passwordCondition.copy();
		}
		if(other.saltCondition != null) {
			this.saltCondition = other.saltCondition.copy();
		}
		if(other.genderCondition != null) {
			this.genderCondition = other.genderCondition.copy();
		}
		if(other.statusCondition != null) {
			this.statusCondition = other.statusCondition.copy();
		}
		if(other.lastLoginTimeCondition != null) {
			this.lastLoginTimeCondition = other.lastLoginTimeCondition.copy();
		}
		if(other.pwdWrongNumberCondition != null) {
			this.pwdWrongNumberCondition = other.pwdWrongNumberCondition.copy();
		}
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		this.setOther(other);
	}

	private void setOther(UserQuery other){

		if(other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
		if(other.modifiedTimeCondition != null) {
			this.modifiedTimeCondition = other.modifiedTimeCondition.copy();
		}
		if(other.modifiedByCondition != null) {
			this.modifiedByCondition = other.modifiedByCondition.copy();
		}
		if(other.delCondition != null) {
			this.delCondition = other.delCondition.copy();
		}
		if(other.delByCondition != null) {
			this.delByCondition = other.delByCondition.copy();
		}
		if(other.delTimeCondition != null) {
			this.delTimeCondition = other.delTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<UserEntity> toQueryWrapper() {
		QueryWrapper<UserEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (usernameCondition != null) {
			usernameCondition.toWrapper(wrapper, COL_USERNAME);
		}
		if (mobileCondition != null) {
			mobileCondition.toWrapper(wrapper, COL_MOBILE);
		}
		if (emailCondition != null) {
			emailCondition.toWrapper(wrapper, COL_EMAIL);
		}
		if (idCardCondition != null) {
			idCardCondition.toWrapper(wrapper, COL_ID_CARD);
		}
		if (passwordCondition != null) {
			passwordCondition.toWrapper(wrapper, COL_PASSWORD);
		}
		if (saltCondition != null) {
			saltCondition.toWrapper(wrapper, COL_SALT);
		}
		if (genderCondition != null) {
			genderCondition.toWrapper(wrapper, COL_GENDER);
		}
		if (statusCondition != null) {
			statusCondition.toWrapper(wrapper, COL_STATUS);
		}
		if (lastLoginTimeCondition != null) {
			lastLoginTimeCondition.toWrapper(wrapper, COL_LAST_LOGIN_TIME);
		}
		if (pwdWrongNumberCondition != null) {
			pwdWrongNumberCondition.toWrapper(wrapper, COL_PWD_WRONG_NUMBER);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		return getQueryWrapper(wrapper);
	}

	private QueryWrapper<UserEntity> getQueryWrapper(QueryWrapper<UserEntity> wrapper){

		if (modifiedTimeCondition != null) {
			modifiedTimeCondition.toWrapper(wrapper, COL_MODIFIED_TIME);
		}
		if (modifiedByCondition != null) {
			modifiedByCondition.toWrapper(wrapper, COL_MODIFIED_BY);
		}
		if (delCondition != null) {
			delCondition.toWrapper(wrapper, COL_DEL);
		}
		if (delByCondition != null) {
			delByCondition.toWrapper(wrapper, COL_DEL_BY);
		}
		if (delTimeCondition != null) {
			delTimeCondition.toWrapper(wrapper, COL_DEL_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return usernameCondition 查询条件
	 */
	public Condition<String> username() {
		this.usernameCondition = new Condition<>();
		return this.usernameCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return usernameCondition 查询条件
	 */
	public Condition<String> getUsernameCondition() {
		return usernameCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param usernameCondition 查询条件
	 */
	public void setUsernameCondition(Condition<String> usernameCondition) {
		this.usernameCondition = usernameCondition;
	}

	/**
	 * 构造并返回手机号查询条件
	 * 
	 * @return mobileCondition 手机号查询条件
	 */
	public Condition<String> mobile() {
		this.mobileCondition = new Condition<>();
		return this.mobileCondition;
	}
	
	/**
	 * 获取手机号查询条件
	 * 
	 * @return mobileCondition 手机号查询条件
	 */
	public Condition<String> getMobileCondition() {
		return mobileCondition;
	}

	/**
	 * 设置手机号查询条件
	 * 
	 * @param mobileCondition 手机号查询条件
	 */
	public void setMobileCondition(Condition<String> mobileCondition) {
		this.mobileCondition = mobileCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return emailCondition 查询条件
	 */
	public Condition<String> email() {
		this.emailCondition = new Condition<>();
		return this.emailCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return emailCondition 查询条件
	 */
	public Condition<String> getEmailCondition() {
		return emailCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param emailCondition 查询条件
	 */
	public void setEmailCondition(Condition<String> emailCondition) {
		this.emailCondition = emailCondition;
	}

	/**
	 * 构造并返回身份证查询条件
	 * 
	 * @return idCardCondition 身份证查询条件
	 */
	public Condition<String> idCard() {
		this.idCardCondition = new Condition<>();
		return this.idCardCondition;
	}
	
	/**
	 * 获取身份证查询条件
	 * 
	 * @return idCardCondition 身份证查询条件
	 */
	public Condition<String> getIdCardCondition() {
		return idCardCondition;
	}

	/**
	 * 设置身份证查询条件
	 * 
	 * @param idCardCondition 身份证查询条件
	 */
	public void setIdCardCondition(Condition<String> idCardCondition) {
		this.idCardCondition = idCardCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return passwordCondition 查询条件
	 */
	public Condition<String> password() {
		this.passwordCondition = new Condition<>();
		return this.passwordCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return passwordCondition 查询条件
	 */
	public Condition<String> getPasswordCondition() {
		return passwordCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param passwordCondition 查询条件
	 */
	public void setPasswordCondition(Condition<String> passwordCondition) {
		this.passwordCondition = passwordCondition;
	}

	/**
	 * 构造并返回盐，用于密码签名查询条件
	 * 
	 * @return saltCondition 盐，用于密码签名查询条件
	 */
	public Condition<String> salt() {
		this.saltCondition = new Condition<>();
		return this.saltCondition;
	}
	
	/**
	 * 获取盐，用于密码签名查询条件
	 * 
	 * @return saltCondition 盐，用于密码签名查询条件
	 */
	public Condition<String> getSaltCondition() {
		return saltCondition;
	}

	/**
	 * 设置盐，用于密码签名查询条件
	 * 
	 * @param saltCondition 盐，用于密码签名查询条件
	 */
	public void setSaltCondition(Condition<String> saltCondition) {
		this.saltCondition = saltCondition;
	}

	/**
	 * 构造并返回[枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 * 
	 * @return genderCondition [枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 */
	public Condition<UserGender> gender() {
		this.genderCondition = new Condition<>();
		return this.genderCondition;
	}
	
	/**
	 * 获取[枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 * 
	 * @return genderCondition [枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 */
	public Condition<UserGender> getGenderCondition() {
		return genderCondition;
	}

	/**
	 * 设置[枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 * 
	 * @param genderCondition [枚举]性别：1-男-MALE、2-女-FEMALE、3-未知-UNKNOWN查询条件
	 */
	public void setGenderCondition(Condition<UserGender> genderCondition) {
		this.genderCondition = genderCondition;
	}

	/**
	 * 构造并返回[枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 */
	public Condition<UserStatus> status() {
		this.statusCondition = new Condition<>();
		return this.statusCondition;
	}
	
	/**
	 * 获取[枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 */
	public Condition<UserStatus> getStatusCondition() {
		return statusCondition;
	}

	/**
	 * 设置[枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 * 
	 * @param statusCondition [枚举]状态：0-未激活-INACTIVE、1-已启用-ENABLED、2-禁用-DISABLED查询条件
	 */
	public void setStatusCondition(Condition<UserStatus> statusCondition) {
		this.statusCondition = statusCondition;
	}

	/**
	 * 构造并返回最后登陆时间查询条件
	 * 
	 * @return lastLoginTimeCondition 最后登陆时间查询条件
	 */
	public Condition<LocalDateTime> lastLoginTime() {
		this.lastLoginTimeCondition = new Condition<>();
		return this.lastLoginTimeCondition;
	}
	
	/**
	 * 获取最后登陆时间查询条件
	 * 
	 * @return lastLoginTimeCondition 最后登陆时间查询条件
	 */
	public Condition<LocalDateTime> getLastLoginTimeCondition() {
		return lastLoginTimeCondition;
	}

	/**
	 * 设置最后登陆时间查询条件
	 * 
	 * @param lastLoginTimeCondition 最后登陆时间查询条件
	 */
	public void setLastLoginTimeCondition(Condition<LocalDateTime> lastLoginTimeCondition) {
		this.lastLoginTimeCondition = lastLoginTimeCondition;
	}

	/**
	 * 构造并返回密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 * 
	 * @return pwdWrongNumberCondition 密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 */
	public Condition<Boolean> pwdWrongNumber() {
		this.pwdWrongNumberCondition = new Condition<>();
		return this.pwdWrongNumberCondition;
	}
	
	/**
	 * 获取密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 * 
	 * @return pwdWrongNumberCondition 密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 */
	public Condition<Boolean> getPwdWrongNumberCondition() {
		return pwdWrongNumberCondition;
	}

	/**
	 * 设置密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 * 
	 * @param pwdWrongNumberCondition 密码错误次数,输入密码正确修改为0 输入密码错误增加一次 输入正确改为0查询条件
	 */
	public void setPwdWrongNumberCondition(Condition<Boolean> pwdWrongNumberCondition) {
		this.pwdWrongNumberCondition = pwdWrongNumberCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return createdTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return createdTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param createdTimeCondition 查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param createdByCondition 查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return modifiedTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> modifiedTime() {
		this.modifiedTimeCondition = new Condition<>();
		return this.modifiedTimeCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return modifiedTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> getModifiedTimeCondition() {
		return modifiedTimeCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param modifiedTimeCondition 查询条件
	 */
	public void setModifiedTimeCondition(Condition<LocalDateTime> modifiedTimeCondition) {
		this.modifiedTimeCondition = modifiedTimeCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return modifiedByCondition 查询条件
	 */
	public Condition<String> modifiedBy() {
		this.modifiedByCondition = new Condition<>();
		return this.modifiedByCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return modifiedByCondition 查询条件
	 */
	public Condition<String> getModifiedByCondition() {
		return modifiedByCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param modifiedByCondition 查询条件
	 */
	public void setModifiedByCondition(Condition<String> modifiedByCondition) {
		this.modifiedByCondition = modifiedByCondition;
	}

	/**
	 * 构造并返回逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @return delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public Condition<Boolean> del() {
		this.delCondition = new Condition<>();
		return this.delCondition;
	}
	
	/**
	 * 获取逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @return delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public Condition<Boolean> getDelCondition() {
		return delCondition;
	}

	/**
	 * 设置逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @param delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public void setDelCondition(Condition<Boolean> delCondition) {
		this.delCondition = delCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return delByCondition 查询条件
	 */
	public Condition<String> delBy() {
		this.delByCondition = new Condition<>();
		return this.delByCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return delByCondition 查询条件
	 */
	public Condition<String> getDelByCondition() {
		return delByCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param delByCondition 查询条件
	 */
	public void setDelByCondition(Condition<String> delByCondition) {
		this.delByCondition = delByCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return delTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> delTime() {
		this.delTimeCondition = new Condition<>();
		return this.delTimeCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return delTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> getDelTimeCondition() {
		return delTimeCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param delTimeCondition 查询条件
	 */
	public void setDelTimeCondition(Condition<LocalDateTime> delTimeCondition) {
		this.delTimeCondition = delTimeCondition;
	}

}
